Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Service map - fixes layout issues for maps with no rum services #62887

Merged

Conversation

ogupte
Copy link
Contributor

@ogupte ogupte commented Apr 7, 2020

Closes #62878 by improving the root selection algorithm. Instead of just using cytoscape's elements.roots() selector. We now also use elements.leaves(), then use breadth first search to get the furthest node from the leaves, and includes that in the set of root nodes. This addresses the issues where some service maps do not have any services without incoming edges, (those returned from the elements.roots() function alone).

Fixes service map layout:
Screen Shot 2020-04-07 at 4 00 12 PM

Old service map layout for the same data:
Screen Shot 2020-04-07 at 3 51 49 PM

@ogupte ogupte added release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v7.8.0 apm-test-plan-7.7.0 labels Apr 7, 2020
@ogupte ogupte requested a review from a team as a code owner April 7, 2020 23:50
Comment on lines +97 to +105
const bfs = cy.elements().bfs({
roots: cy.elements().leaves()
});
const furthestNodeFromLeaves = bfs.path.last();
return cy
.elements()
.roots()
.union(furthestNodeFromLeaves)
.map(el => el.id());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change to the root selection logic: Get the leaves of the graph (no outgoing edges), then use BFS to obtain the furthest node from the leaves. Return this node + any nodes which have no incoming edges (from .roots()) to get the set of effective roots from the perspective of the breadthfirst layout.

eles: serviceName
? event.cy.getElementById(serviceName)
: event.cy.collection()
setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you have to clean up this timeout on unmount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. I'll update it. I'm not sure if it will ever need cleanup in practice, but better to be safe here.

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tenor-106686228

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ogupte ogupte merged commit 184f594 into elastic:master Apr 8, 2020
ogupte added a commit to ogupte/kibana that referenced this pull request Apr 8, 2020
…elastic#62887)

* Closes elastic#62878 in Service Maps by improving the selection algorithm for root nodes

* Fixes some latent centering issues when navigating in the service map.

* Removes unused imports

* Added layoutstopDelayTimeout to cleanup step
ogupte added a commit to ogupte/kibana that referenced this pull request Apr 8, 2020
…elastic#62887)

* Closes elastic#62878 in Service Maps by improving the selection algorithm for root nodes

* Fixes some latent centering issues when navigating in the service map.

* Removes unused imports

* Added layoutstopDelayTimeout to cleanup step
ogupte added a commit that referenced this pull request Apr 9, 2020
…#62887) (#63002)

* Closes #62878 in Service Maps by improving the selection algorithm for root nodes

* Fixes some latent centering issues when navigating in the service map.

* Removes unused imports

* Added layoutstopDelayTimeout to cleanup step
ogupte added a commit that referenced this pull request Apr 9, 2020
…#62887) (#63003)

* Closes #62878 in Service Maps by improving the selection algorithm for root nodes

* Fixes some latent centering issues when navigating in the service map.

* Removes unused imports

* Added layoutstopDelayTimeout to cleanup step
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 9, 2020
…chore/put-all-xjson-together

* 'master' of github.com:elastic/kibana: (35 commits)
  [SIEM] [Detection Engine] Fixes bug when notification doesn't… (elastic#63013)
  [SIEM][Detection Engine] Fix rule notification critical bugs
  Add Error Exception Type Column (elastic#59596)
  [APM] Agent remote configuration: changes in Java property descriptions (elastic#62282)
  [Alerting] Displays warning when a permanent encryption key is missing and hides alerting UI appropriately (elastic#62772)
  FTR: add chromium-based Edge browser support (elastic#61684)
  [Ingest] Data source configuration validation UI (elastic#61180)
  restore empty_kibana after saved objects test (elastic#62951)
  Index pattern management plugin - src/legacy/core_plugins/management => new platform plugin (elastic#62594)
  Add basic StatusService (elastic#60335)
  [kbn/optimizer] link to kibanaReact/kibanaUtils plugins (elastic#62720)
  [APM] Service map - fixes layout issues for maps with no rum services (elastic#62887)
  Exclude disabled datasources and streams from agent config (elastic#62869)
  [Alerting] Fix validation support for nested IErrorObjects (elastic#62833)
  [Metrics UI] Invalidate non-count alerts which have no metrics (elastic#62837)
  Add --filter option to API docs script (elastic#62888)
  [Maps] fix attribution overflow with exit full screen button (elastic#62699)
  [Uptime]Alerting UI text in case filter is selected (elastic#62570)
  [Maps] Show create filter button for top-term tooltip property (elastic#62461)
  skip flaky suite (elastic#59030)
  ...

# Conflicts:
#	src/plugins/es_ui_shared/public/index.ts
gmmorris added a commit to gmmorris/kibana that referenced this pull request Apr 9, 2020
* master: (40 commits)
  [ML] Functional transform tests - stabilize source selection (elastic#63087)
  add embed flag to saved object url as well (elastic#62926)
  [SIEM] [Detection Engine] Fixes bug when notification doesn't… (elastic#63013)
  [SIEM][Detection Engine] Fix rule notification critical bugs
  Add Error Exception Type Column (elastic#59596)
  [APM] Agent remote configuration: changes in Java property descriptions (elastic#62282)
  [Alerting] Displays warning when a permanent encryption key is missing and hides alerting UI appropriately (elastic#62772)
  FTR: add chromium-based Edge browser support (elastic#61684)
  [Ingest] Data source configuration validation UI (elastic#61180)
  restore empty_kibana after saved objects test (elastic#62951)
  Index pattern management plugin - src/legacy/core_plugins/management => new platform plugin (elastic#62594)
  Add basic StatusService (elastic#60335)
  [kbn/optimizer] link to kibanaReact/kibanaUtils plugins (elastic#62720)
  [APM] Service map - fixes layout issues for maps with no rum services (elastic#62887)
  Exclude disabled datasources and streams from agent config (elastic#62869)
  [Alerting] Fix validation support for nested IErrorObjects (elastic#62833)
  [Metrics UI] Invalidate non-count alerts which have no metrics (elastic#62837)
  Add --filter option to API docs script (elastic#62888)
  [Maps] fix attribution overflow with exit full screen button (elastic#62699)
  [Uptime]Alerting UI text in case filter is selected (elastic#62570)
  ...
@cauemarcondes cauemarcondes self-assigned this Apr 9, 2020
@cauemarcondes
Copy link
Contributor

Tests ok:
✅Chrome
✅Safari
✅Firefox

@cauemarcondes cauemarcondes added the apm:test-plan-done Pull request that was successfully tested during the test plan label Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:test-plan-done Pull request that was successfully tested during the test plan release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v7.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Service map - Layout bug when there are not valid root nodes
4 participants